﻿using Linq2Rest.Provider;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xinchen.SOA.Client
{
    public class SOAHttpRequestFactory : IHttpRequestFactory
    {
        /// <summary>
        /// Creates an IHttpRequest that can be used to send an http request.
        /// </summary>
        /// <param name="uri">The location the request is to be sent to.</param>
        /// <param name="method">The method to use to send the request.</param>
        /// <param name="responseMimeType">The Mime type we accept in response.</param>
        /// <param name="requestMimeType">The Mime type we are sending in request.</param>
        /// <returns>The HttpRequest we are creating.</returns>
        public IHttpRequest Create(Uri uri, HttpMethod method, string responseMimeType, string requestMimeType)
        {
            var httpWebRequest = SOAHttpWebRequestAdapter.CreateHttpWebRequest(uri, method, responseMimeType, requestMimeType);
            return new SOAHttpWebRequestAdapter(httpWebRequest);
        }
    }
}
